/*
 * @(#)cn.design.pattern.adapter.springmvc 2020/4/15/0015
 *
 * Copy Right@ 人人译视界
 */


package cn.design.pattern.adapter.springmvc;

/**
 * <pre>
 * @author tuwei
 *
 * @version 0.9
 *
 * 修改版本: 0.9
 * 修改日期: 2020/4/15/0015
 * 修改人 :  tuwei
 * 修改说明: 初步完成
 * 复审人 ：
 * </pre>
 */
public interface HandlerAdapter {
	public boolean supports(Object handler);

	public void handle(Object handler);
}

class SimpleHandlerAdapter implements HandlerAdapter {

	@Override
	public boolean supports(Object handler) {
		if (handler instanceof SimpleController) {
			((SimpleController) handler).doSimpleHandler();
			return true;
		}
		return false;
	}
	@Override
	public void handle(Object handler) {
	}
}

class HttpHandlerAdapter implements HandlerAdapter {

	@Override
	public boolean supports(Object handler) {
		if (handler instanceof HttpController) {
			((HttpController) handler).doHttpHandler();
			return true;
		}
		return false;
	}

	@Override
	public void handle(Object handler) {

	}
}

class AnnotationHandlerAdapter implements HandlerAdapter {

	@Override
	public boolean supports(Object handler) {
		if (handler instanceof AnnotationController) {
			((AnnotationController) handler).doAnnotationHandler();
			return true;
		}
		return false;
	}

	@Override
	public void handle(Object handler) {

	}
}